 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKXdata/XdataModel.h>

@implementation DwDatabase
-(id) initWithId:(NSNumber*) idValue
      userName:(NSString*)userName
      databaseName:(NSString*)databaseName
      totalTableQuantity:(NSNumber*)totalTableQuantity
      createTime:(NSString*)createTime
      lastUpdateTime:(NSString*)lastUpdateTime
      physicalStorageCapacity:(NSString*)physicalStorageCapacity
      category:(NSString*)category
      source:(NSString*)source
      owner:(NSString*)owner
      location:(NSString*)location
      comments:(NSString*)comments { 
     self.idValue = idValue;               
     self.userName = userName;               
     self.databaseName = databaseName;               
     self.totalTableQuantity = totalTableQuantity;               
     self.createTime = createTime;               
     self.lastUpdateTime = lastUpdateTime;               
     self.physicalStorageCapacity = physicalStorageCapacity;               
     self.category = category;               
     self.source = source;               
     self.owner = owner;               
     self.location = location;               
     self.comments = comments;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    if([self userName])
    {
        [result setValue:[self userName] forKey:@"userName"];
    }
    if([self databaseName])
    {
        [result setValue:[self databaseName] forKey:@"databaseName"];
    }
    if([self totalTableQuantity])
    {
        [result setValue:[self totalTableQuantity] forKey:@"totalTableQuantity"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self lastUpdateTime])
    {
        [result setValue:[self lastUpdateTime] forKey:@"lastUpdateTime"];
    }
    if([self physicalStorageCapacity])
    {
        [result setValue:[self physicalStorageCapacity] forKey:@"physicalStorageCapacity"];
    }
    if([self category])
    {
        [result setValue:[self category] forKey:@"category"];
    }
    if([self source])
    {
        [result setValue:[self source] forKey:@"source"];
    }
    if([self owner])
    {
        [result setValue:[self owner] forKey:@"owner"];
    }
    if([self location])
    {
        [result setValue:[self location] forKey:@"location"];
    }
    if([self comments])
    {
        [result setValue:[self comments] forKey:@"comments"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.idValue = [dictionary objectForKey:@"id"];
    self.userName = [dictionary objectForKey:@"userName"];
    self.databaseName = [dictionary objectForKey:@"databaseName"];
    self.totalTableQuantity = [dictionary objectForKey:@"totalTableQuantity"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.lastUpdateTime = [dictionary objectForKey:@"lastUpdateTime"];
    self.physicalStorageCapacity = [dictionary objectForKey:@"physicalStorageCapacity"];
    self.category = [dictionary objectForKey:@"category"];
    self.source = [dictionary objectForKey:@"source"];
    self.owner = [dictionary objectForKey:@"owner"];
    self.location = [dictionary objectForKey:@"location"];
    self.comments = [dictionary objectForKey:@"comments"];
    return self;
}
 @end
@implementation DwInstance
-(id) initWithInstanceName:(NSString*) instanceName
      comments:(NSString*)comments
      instanceOwnerName:(NSString*)instanceOwnerName
      area:(NSString*)area
      uname:(NSString*)uname
      createTime:(NSString*)createTime { 
     self.instanceName = instanceName;               
     self.comments = comments;               
     self.instanceOwnerName = instanceOwnerName;               
     self.area = area;               
     self.uname = uname;               
     self.createTime = createTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instanceName])
    {
        [result setValue:[self instanceName] forKey:@"instanceName"];
    }
    if([self comments])
    {
        [result setValue:[self comments] forKey:@"comments"];
    }
    if([self instanceOwnerName])
    {
        [result setValue:[self instanceOwnerName] forKey:@"instanceOwnerName"];
    }
    if([self area])
    {
        [result setValue:[self area] forKey:@"area"];
    }
    if([self uname])
    {
        [result setValue:[self uname] forKey:@"uname"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceName = [dictionary objectForKey:@"instanceName"];
    self.comments = [dictionary objectForKey:@"comments"];
    self.instanceOwnerName = [dictionary objectForKey:@"instanceOwnerName"];
    self.area = [dictionary objectForKey:@"area"];
    self.uname = [dictionary objectForKey:@"uname"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    return self;
}
 @end
@implementation DwDatabaseInfo
-(id) initWithOwner:(NSString*) owner
      comments:(NSString*)comments
      databaseName:(NSString*)databaseName { 
     self.owner = owner;               
     self.comments = comments;               
     self.databaseName = databaseName;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self owner])
    {
        [result setValue:[self owner] forKey:@"owner"];
    }
    if([self comments])
    {
        [result setValue:[self comments] forKey:@"comments"];
    }
    if([self databaseName])
    {
        [result setValue:[self databaseName] forKey:@"databaseName"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.owner = [dictionary objectForKey:@"owner"];
    self.comments = [dictionary objectForKey:@"comments"];
    self.databaseName = [dictionary objectForKey:@"databaseName"];
    return self;
}
 @end
@implementation DwTableRow
-(id) initWithColumnName:(NSString*) columnName
      columnType:(NSString*)columnType
      isPartition:(NSNumber*)isPartition
      comments:(NSString*)comments { 
     self.columnName = columnName;               
     self.columnType = columnType;               
     self.isPartition = isPartition;               
     self.comments = comments;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self columnName])
    {
        [result setValue:[self columnName] forKey:@"columnName"];
    }
    if([self columnType])
    {
        [result setValue:[self columnType] forKey:@"columnType"];
    }
    if([self isPartition])
    {
        [result setValue:[self isPartition] forKey:@"isPartition"];
    }
    if([self comments])
    {
        [result setValue:[self comments] forKey:@"comments"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.columnName = [dictionary objectForKey:@"columnName"];
    self.columnType = [dictionary objectForKey:@"columnType"];
    self.isPartition = [dictionary objectForKey:@"isPartition"];
    self.comments = [dictionary objectForKey:@"comments"];
    return self;
}
 @end
@implementation DwHiveObjectPrivileges
-(id) initWithStatus:(NSNumber*) status
      message:(NSString*)message
      select:(NSNumber*)select
      insert:(NSNumber*)insert
      update:(NSNumber*)update
      delete:(NSNumber*)delete
      drop:(NSNumber*)drop
      create:(NSNumber*)create
      alter:(NSNumber*)alter
      owner:(NSNumber*)owner { 
     self.status = status;               
     self.message = message;               
     self.select = select;               
     self.insert = insert;               
     self.update = update;               
     self.delete = delete;               
     self.drop = drop;               
     self.create = create;               
     self.alter = alter;               
     self.owner = owner;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self status])
    {
        [result setValue:[self status] forKey:@"status"];
    }
    if([self message])
    {
        [result setValue:[self message] forKey:@"message"];
    }
    if([self select])
    {
        [result setValue:[self select] forKey:@"select"];
    }
    if([self insert])
    {
        [result setValue:[self insert] forKey:@"insert"];
    }
    if([self update])
    {
        [result setValue:[self update] forKey:@"update"];
    }
    if([self delete])
    {
        [result setValue:[self delete] forKey:@"delete"];
    }
    if([self drop])
    {
        [result setValue:[self drop] forKey:@"drop"];
    }
    if([self create])
    {
        [result setValue:[self create] forKey:@"create"];
    }
    if([self alter])
    {
        [result setValue:[self alter] forKey:@"alter"];
    }
    if([self owner])
    {
        [result setValue:[self owner] forKey:@"owner"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.status = [dictionary objectForKey:@"status"];
    self.message = [dictionary objectForKey:@"message"];
    self.select = [dictionary objectForKey:@"select"];
    self.insert = [dictionary objectForKey:@"insert"];
    self.update = [dictionary objectForKey:@"update"];
    self.delete = [dictionary objectForKey:@"delete"];
    self.drop = [dictionary objectForKey:@"drop"];
    self.create = [dictionary objectForKey:@"create"];
    self.alter = [dictionary objectForKey:@"alter"];
    self.owner = [dictionary objectForKey:@"owner"];
    return self;
}
 @end
@implementation DwTableDesc
-(id) initWithDbName:(NSString*) dbName
      tableName:(NSString*)tableName
      hiveFileFormat:(NSString*)hiveFileFormat
      fieldsDelimit:(NSString*)fieldsDelimit
      linesDelimit:(NSString*)linesDelimit
      otherSerdeProperties:(NSObject*)otherSerdeProperties
      createTime:(NSString*)createTime
      owner:(NSString*)owner
      comments:(NSString*)comments
      externalLocation:(NSString*)externalLocation
      parameters:(NSObject*)parameters
      rows:(NSArray<DwTableRow*>*)rows { 
     self.dbName = dbName;               
     self.tableName = tableName;               
     self.hiveFileFormat = hiveFileFormat;               
     self.fieldsDelimit = fieldsDelimit;               
     self.linesDelimit = linesDelimit;               
     self.otherSerdeProperties = otherSerdeProperties;               
     self.createTime = createTime;               
     self.owner = owner;               
     self.comments = comments;               
     self.externalLocation = externalLocation;               
     self.parameters = parameters;               
     self.rows = rows;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self dbName])
    {
        [result setValue:[self dbName] forKey:@"dbName"];
    }
    if([self tableName])
    {
        [result setValue:[self tableName] forKey:@"tableName"];
    }
    if([self hiveFileFormat])
    {
        [result setValue:[self hiveFileFormat] forKey:@"hiveFileFormat"];
    }
    if([self fieldsDelimit])
    {
        [result setValue:[self fieldsDelimit] forKey:@"fieldsDelimit"];
    }
    if([self linesDelimit])
    {
        [result setValue:[self linesDelimit] forKey:@"linesDelimit"];
    }
    if([self otherSerdeProperties])
    {
        [result setValue:[self otherSerdeProperties] forKey:@"otherSerdeProperties"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self owner])
    {
        [result setValue:[self owner] forKey:@"owner"];
    }
    if([self comments])
    {
        [result setValue:[self comments] forKey:@"comments"];
    }
    if([self externalLocation])
    {
        [result setValue:[self externalLocation] forKey:@"externalLocation"];
    }
    if([self parameters])
    {
        [result setValue:[self parameters] forKey:@"parameters"];
    }
    if([self rows])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self rows] count]; i++) {
            DwTableRow* item = [[self rows] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"rows"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.dbName = [dictionary objectForKey:@"dbName"];
    self.tableName = [dictionary objectForKey:@"tableName"];
    self.hiveFileFormat = [dictionary objectForKey:@"hiveFileFormat"];
    self.fieldsDelimit = [dictionary objectForKey:@"fieldsDelimit"];
    self.linesDelimit = [dictionary objectForKey:@"linesDelimit"];
    self.otherSerdeProperties = [dictionary objectForKey:@"otherSerdeProperties"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.owner = [dictionary objectForKey:@"owner"];
    self.comments = [dictionary objectForKey:@"comments"];
    self.externalLocation = [dictionary objectForKey:@"externalLocation"];
    self.parameters = [dictionary objectForKey:@"parameters"];
    NSArray* rowsArray = [dictionary objectForKey:@"rows"];
    if(rowsArray&&![rowsArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [rowsArray count];i++)
        {
            DwTableRow* item = [[DwTableRow alloc]initWithDic:[rowsArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.rows = propertyArray;
    }
    return self;
}
 @end
@implementation DwTable
-(id) initWithId:(NSNumber*) idValue
      userName:(NSString*)userName
      dbName:(NSString*)dbName
      tableName:(NSString*)tableName
      createTime:(NSString*)createTime
      lastUpdateTime:(NSString*)lastUpdateTime
      physicalStorageCapacity:(NSString*)physicalStorageCapacity
      category:(NSString*)category
      source:(NSString*)source
      owner:(NSString*)owner
      hiveFileFormat:(NSString*)hiveFileFormat
      encryption:(NSString*)encryption
      location:(NSString*)location
      comments:(NSString*)comments
      hiveObjectPrivileges:(DwHiveObjectPrivileges*)hiveObjectPrivileges
      parameters:(NSObject*)parameters { 
     self.idValue = idValue;               
     self.userName = userName;               
     self.dbName = dbName;               
     self.tableName = tableName;               
     self.createTime = createTime;               
     self.lastUpdateTime = lastUpdateTime;               
     self.physicalStorageCapacity = physicalStorageCapacity;               
     self.category = category;               
     self.source = source;               
     self.owner = owner;               
     self.hiveFileFormat = hiveFileFormat;               
     self.encryption = encryption;               
     self.location = location;               
     self.comments = comments;               
     self.hiveObjectPrivileges = hiveObjectPrivileges;               
     self.parameters = parameters;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self idValue])
    {
        [result setValue:[self idValue] forKey:@"id"];
    }
    if([self userName])
    {
        [result setValue:[self userName] forKey:@"userName"];
    }
    if([self dbName])
    {
        [result setValue:[self dbName] forKey:@"dbName"];
    }
    if([self tableName])
    {
        [result setValue:[self tableName] forKey:@"tableName"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self lastUpdateTime])
    {
        [result setValue:[self lastUpdateTime] forKey:@"lastUpdateTime"];
    }
    if([self physicalStorageCapacity])
    {
        [result setValue:[self physicalStorageCapacity] forKey:@"physicalStorageCapacity"];
    }
    if([self category])
    {
        [result setValue:[self category] forKey:@"category"];
    }
    if([self source])
    {
        [result setValue:[self source] forKey:@"source"];
    }
    if([self owner])
    {
        [result setValue:[self owner] forKey:@"owner"];
    }
    if([self hiveFileFormat])
    {
        [result setValue:[self hiveFileFormat] forKey:@"hiveFileFormat"];
    }
    if([self encryption])
    {
        [result setValue:[self encryption] forKey:@"encryption"];
    }
    if([self location])
    {
        [result setValue:[self location] forKey:@"location"];
    }
    if([self comments])
    {
        [result setValue:[self comments] forKey:@"comments"];
    }
    if([self hiveObjectPrivileges])
    {
        [result setValue:[[self hiveObjectPrivileges] dictionary]forKey:@"hiveObjectPrivileges"];
    }
    if([self parameters])
    {
        [result setValue:[self parameters] forKey:@"parameters"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.idValue = [dictionary objectForKey:@"id"];
    self.userName = [dictionary objectForKey:@"userName"];
    self.dbName = [dictionary objectForKey:@"dbName"];
    self.tableName = [dictionary objectForKey:@"tableName"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.lastUpdateTime = [dictionary objectForKey:@"lastUpdateTime"];
    self.physicalStorageCapacity = [dictionary objectForKey:@"physicalStorageCapacity"];
    self.category = [dictionary objectForKey:@"category"];
    self.source = [dictionary objectForKey:@"source"];
    self.owner = [dictionary objectForKey:@"owner"];
    self.hiveFileFormat = [dictionary objectForKey:@"hiveFileFormat"];
    self.encryption = [dictionary objectForKey:@"encryption"];
    self.location = [dictionary objectForKey:@"location"];
    self.comments = [dictionary objectForKey:@"comments"];
    self.hiveObjectPrivileges = [[DwHiveObjectPrivileges alloc]initWithDic:[dictionary objectForKey:@"hiveObjectPrivileges"]];
    self.parameters = [dictionary objectForKey:@"parameters"];
    return self;
}
 @end
 
 


